﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.U2D.SpriteAtlasManager
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Scripting;

#nullable disable
namespace UnityEngine.U2D
{
  /// <summary>
  ///   <para>Manages SpriteAtlas during runtime.</para>
  /// </summary>
  [NativeHeader("Runtime/2D/SpriteAtlas/SpriteAtlasManager.h")]
  [NativeHeader("Runtime/2D/SpriteAtlas/SpriteAtlas.h")]
  [StaticAccessor("GetSpriteAtlasManager()", StaticAccessorType.Dot)]
  public class SpriteAtlasManager
  {
    public static event Action<string, Action<SpriteAtlas>> atlasRequested;

    [RequiredByNativeCode]
    private static bool RequestAtlas(string tag)
    {
      if (SpriteAtlasManager.atlasRequested == null)
        return false;
      SpriteAtlasManager.atlasRequested(tag, new Action<SpriteAtlas>(SpriteAtlasManager.Register));
      return true;
    }

    public static event Action<SpriteAtlas> atlasRegistered;

    [RequiredByNativeCode]
    private static void PostRegisteredAtlas(SpriteAtlas spriteAtlas)
    {
      Action<SpriteAtlas> atlasRegistered = SpriteAtlasManager.atlasRegistered;
      if (atlasRegistered == null)
        return;
      atlasRegistered(spriteAtlas);
    }

    [MethodImpl(MethodImplOptions.InternalCall)]
    internal static extern void Register(SpriteAtlas spriteAtlas);
  }
}
